package com.cmwa.solution.business.register.service.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cmwa.solution.base.entity.Employee;
import com.cmwa.solution.base.entity.Page;
import com.cmwa.solution.base.entity.SearchParam;
import com.cmwa.solution.business.product.entity.ProjectInfoVo;
import com.cmwa.solution.business.register.dao.SalesCapitalManageDao;
import com.cmwa.solution.business.register.entity.CustTransferVo;
import com.cmwa.solution.business.register.entity.ProductReceiveVo;
import com.cmwa.solution.business.register.service.SalesCapitalManageService;
import com.cmwa.solution.utils.SessionUtils;

/**
 * 	销售资金管理业务层
 * @author ex-wuh2
 */
@Service
public class SalesCapitalManageServiceImpl implements SalesCapitalManageService {

	@Autowired
	private SalesCapitalManageDao salesCapitalManageDao;
	

	
	@Override
	public Page<CustTransferVo> queryCustTransferDetailListPage(SearchParam sp) {
		Employee emp = SessionUtils.getEmployee();
		if (StringUtils.equals(emp.getEmpType(), "OUT")) {
			sp.getSp().put("empId", emp.getID());
		}
		List<CustTransferVo> items = salesCapitalManageDao.queryCustTransferDetailListPage(sp);
		return Page.create(items, sp.getStart(), sp.getLimit(), sp.getTotal());
	}
	
	@Override
	public Page<ProductReceiveVo> queryProductReceiveDetailListPage(SearchParam sp) {
		Employee emp = SessionUtils.getEmployee();
		if (StringUtils.equals(emp.getEmpType(), "OUT")) {
			sp.getSp().put("empId", emp.getID());
		}
		List<ProductReceiveVo> items = salesCapitalManageDao.queryProductReceiveDetailListPage(sp);
		return Page.create(items, sp.getStart(), sp.getLimit(), sp.getTotal());
	}

	@Override
	public List<ProjectInfoVo> custRegisProjectInfo(SearchParam sp) {
		return salesCapitalManageDao.custRegisProjectInfo(sp);
	}


}
